﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YQGL.Common;

namespace YQGL.Controllers
{
    public class EnterpriseQueryController : Controller
    {
        BLL.DJ_QYXX QYXXBLL = new BLL.DJ_QYXX();
        //
        // GET: /EnterpriseQuery/

        public ActionResult Index(string gjz, int id = 1)
        {
            string LoginID = OperateSession.get("AdminLoginID");
            if (string.IsNullOrEmpty(LoginID))
            {

                Response.Redirect(Url.Action("Index", "Index"));
                return null;
            }
            ViewData["srcurl"] = Url.Content("~/EnterpriseQuery/?id=");
          
           
          
            decimal total = 0;
            Model.DJ_QYXX mdl = new Model.DJ_QYXX();
            mdl.Nsrmc = gjz;
            ViewData["gjz"] = gjz;
            DataSet ds = QYXXBLL.GetListByQueryFull(mdl, out total, id, Common.GlobalConstant.CONSTRING_PAGESIZE, null);

            List<Model.DJ_QYXX> DJ_QYXXModelList = QYXXBLL.DataTableToList(ds.Tables[0]);
           


            ViewData["total"] = total;
            int pageCount = (int)total / Common.GlobalConstant.CONSTRING_PAGESIZE;
            if (total % Common.GlobalConstant.CONSTRING_PAGESIZE != 0)
            {
                pageCount = pageCount + 1;
            }
            ViewData["allPage"] = pageCount;
            ViewData["page"] = id;
            return View("Index", DJ_QYXXModelList);
        }

    }
}
